home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWPart / Include / FWProxy.h < prev    next >
Encoding:
Text File  |  1996-04-25  |  9.6 KB  |  297 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWProxy.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWPROXY_H
  11. #define FWPROXY_H
  12.  
  13. // ----- ODF OS Includes -----
  14.  
  15. #ifndef FWFXMATH_H
  16. #include "FWFxMath.h"
  17. #endif
  18.  
  19. // ----- ODF Foundation Includes -----
  20.  
  21. #ifndef FWSTDEF_H
  22. #include "FWStdDef.h"
  23. #endif
  24.  
  25. #ifndef FWCLAINF_H
  26. #include "FWClaInf.h"
  27. #endif
  28.  
  29. #ifndef FWPRIDEB_H
  30. #include "FWPriDeb.h"
  31. #endif
  32.  
  33. #ifndef FWTCOLL_H
  34. #include "FWTColl.h"
  35. #endif
  36.  
  37. //========================================================================================
  38. //    Forward Declarations
  39. //========================================================================================
  40.  
  41. class ODFrame;
  42. class ODShape;
  43. class ODFacet;
  44. class ODStorageUnitView;
  45. class ODTransform;
  46.  
  47. class FW_CCloneInfo;
  48. class FW_CFrame;
  49. class FW_CEmbeddingFrame;
  50. class FW_CEmbeddingPart;
  51. class FW_CProxyFrame;
  52. class FW_CPoint;
  53. class FW_CPresentation;
  54. class FW_CString;
  55.  
  56. //========================================================================================
  57. //    class FW_MProxy
  58. //========================================================================================
  59.  
  60. class FW_MProxy
  61. {
  62.  public:
  63.     friend class FW_CProxyProxyFrameIterator;
  64.     
  65. //----------------------------------------------------------------------------------------
  66. //    Initialization/Destruction
  67. //
  68. public:
  69.     FW_MProxy(Environment* ev, 
  70.                 FW_CEmbeddingPart* embeddingPart, 
  71.                 FW_CPresentation* presentation,
  72.                 FW_Boolean shown = TRUE);
  73.     virtual ~FW_MProxy();
  74.     
  75. //----------------------------------------------------------------------------------------
  76. //    New API
  77. //
  78. public:
  79.     // ----- Embedded frames manipulation -----
  80.     void                        DetachEmbeddedFrames(Environment *ev);
  81.     void                        AttachEmbeddedFrames(Environment *ev);
  82.     void                        RemoveEmbeddedFrames(Environment *ev);
  83.  
  84.     // ----- Notification -----
  85.     virtual void                UsedShapeChanged(Environment *ev,
  86.                                                 FW_CEmbeddingFrame* embeddingFrame,
  87.                                                 ODFrame* odEmbeddedFrame);
  88.  
  89.     virtual ODShape*             FrameShapeRequested(Environment* ev, 
  90.                                                 FW_CEmbeddingFrame* frame,
  91.                                                 ODFrame* odEmbeddedFrame, 
  92.                                                 ODShape* requestedFrameShape);
  93.                                         
  94.     // ----- Query -----
  95.     ODFacet*                    GetEmbeddedFacetUnderMouse(Environment* ev, 
  96.                                     ODFacet* embeddingFacet, 
  97.                                     const FW_CPoint& mouse) const;    
  98.                                     
  99.     ODFrame*                    AcquireEmbeddedFrame(Environment* ev, 
  100.                                     FW_CEmbeddingFrame* embeddingFrame) const;
  101.                                     
  102.     FW_CProxyFrame*                GetProxyFrame(Environment* ev, 
  103.                                     FW_CEmbeddingFrame* embeddingFrame) const;
  104.     
  105.     FW_Boolean                    IsEmbeddedFrame(Environment* ev,
  106.                                     ODFrame* odEmbeddedFrame) const;
  107.                                     
  108.     // ----- Active border -----
  109.     virtual void                AdjustBorderShape(Environment* ev,
  110.                                     FW_CEmbeddingFrame* embeddingFrame, 
  111.                                     ODFacet* embeddedFacet, 
  112.                                     ODShape *shape);
  113.                                     
  114.     // ----- Persistence -----
  115.     void                        Externalize(Environment* ev, 
  116.                                     ODStorageUnitView* destinationSUView,
  117.                                     FW_CCloneInfo *cloneInfo);
  118.     void                        Internalize(Environment* ev, 
  119.                                     ODStorageUnitView* sourceSUView,
  120.                                     FW_CCloneInfo *cloneInfo);
  121.                                                                           
  122.     // ----- Selection state -----
  123.     virtual void                SetSelectState(Environment* ev,
  124.                                     FW_Boolean state);
  125.     FW_Boolean                    GetSelectState(Environment* ev) const;
  126.                                     
  127.     // ----- Highlight state -----
  128.     void                        ChangeHighlight(Environment* ev,
  129.                                     ODHighlight highlight,
  130.                                     FW_CEmbeddingFrame* embeddingFrame = NULL);
  131.                                     
  132.     // ----- Hide/Show Proxy -----
  133.     void                        HideShow(Environment* ev, FW_Boolean state);
  134.     FW_Boolean                    IsShown(Environment* ev) const;
  135.     
  136.     // ----- Open In Window (From OpenSelection Command) -----
  137.     virtual void                OpenInWindow(Environment* ev, FW_CProxyFrame* proxyFrame);
  138.         
  139.     // ----- Position all embedded frames of this proxy -----
  140.     void                         ChangeExternalTransforms(Environment* ev, 
  141.                                     ODTransform* transform);
  142.     void                         ChangeExternalTransforms(Environment* ev, 
  143.                                     FW_Fixed x,
  144.                                     FW_Fixed y);
  145.  
  146.     // ----- Change the frame shape of all embedded frames of this proxy -----
  147.     void                         ChangeFrameShapes(Environment* ev, 
  148.                                     ODShape* newShape);
  149.     void                         ChangeFrameShapes(Environment* ev, 
  150.                                     FW_Fixed width,
  151.                                     FW_Fixed height);
  152.  
  153.     // ----- Set the View Type of this proxy frames -----
  154.     void                        SetEmbeddedFramesViewType(Environment *ev, 
  155.                                     ODTypeToken viewType);
  156.  
  157.     // ----- Frame Group/Sequence Number -----
  158.     ODID                        GetFrameGroup(Environment *ev) const;
  159.     ODID                        GetSequenceNumber(Environment *ev) const;
  160.     void                        ChangeSequenceNumber(Environment *ev, ODID sequenceNumber);
  161.     
  162.     // ----- Getters/Setters -----
  163.     ODPart*                        AcquireEmbeddedPart(Environment* ev) const;
  164.     void                        GetEmbeddedPartName(Environment* ev, FW_CString& string) const;
  165.     
  166.     FW_CEmbeddingPart*            GetPart(Environment* ev) const;
  167.     
  168.     // ----- Presentation -----
  169.     FW_CPresentation*            GetPresentation(Environment* ev) const;
  170.     
  171.                                 
  172.     // ----- Change the link status of all embedded frames of this proxy -----
  173.     void                        ChangeLinkStatus(Environment* ev, ODLinkStatus linkStatus);
  174.  
  175.     // ----- ReleaseAll -----
  176.     virtual void                ReleaseAll(Environment *ev);
  177.     
  178. //----------------------------------------------------------------------------------------
  179. //    Implementation API
  180. //
  181. public:
  182.     // ----- ProxyFrame Factories -----
  183.     FW_CProxyFrame*                PrivNewProxyFrame(Environment* ev, 
  184.                                                 FW_CEmbeddingPart* part,
  185.                                                 ODStorageUnitView* suView);
  186.     FW_CProxyFrame*                PrivNewProxyFrame(Environment* ev, 
  187.                                                 FW_CEmbeddingPart* part, 
  188.                                                 FW_CEmbeddingFrame* containingFrame, 
  189.                                                 ODFrame* embeddedFrame);
  190.     
  191.     void                        PrivAddProxyFrame(Environment* ev, FW_CProxyFrame* proxyFrame);
  192.     void                        PrivDeleteProxyFrame(Environment* ev, FW_CProxyFrame* proxyFrame);
  193.  
  194.     FW_CProxyFrame*                PrivGetProxyFrame(Environment* ev, ODStorageUnitID frameID) const;
  195.     FW_CProxyFrame*                PrivContainerIDToProxyFrame(Environment* ev, ODStorageUnitID containerID) const;
  196.     
  197.     void                        PrivPostClone(Environment* ev,
  198.                                     FW_CCloneInfo* cloneInfo);
  199.     
  200.     void                        PrivEmbeddedFacetAdded(Environment* ev);
  201.     void                        PrivEmbeddedFacetRemoved(Environment* ev);
  202.  
  203.     void                        PrivSetFrameGroup(Environment *ev, ODID frameGroup);
  204.  
  205.     void                        PrivSetDragging(Environment* ev, FW_Boolean state);
  206.                                                             
  207. //----------------------------------------------------------------------------------------
  208. //    Data Members
  209. //----------------------------------------------------------------------------------------
  210.  
  211. private:
  212.     FW_Boolean                                fDetached;
  213.     FW_TOrderedCollection<FW_CProxyFrame>*    fProxyFrames;
  214.     FW_CEmbeddingPart*                        fPart;
  215.     FW_CPresentation*                        fPresentation;
  216.     FW_Boolean                                fSelected;
  217.     ODStorageUnitID                            fClonedFrameID;        // Used during cloning
  218.     unsigned short                            fEmbeddedFacetCount;
  219.     FW_Boolean                                fShown;
  220.     ODID                                    fFrameGroup;
  221.     ODID                                    fSequenceNumber;
  222.     FW_Boolean                                fDragging;            
  223. };
  224.  
  225.  
  226. //========================================================================================
  227. //    FW_MProxy Inlines
  228. //========================================================================================
  229.  
  230. //----------------------------------------------------------------------------------------
  231. //    FW_MProxy::GetPart
  232. //----------------------------------------------------------------------------------------
  233. inline FW_CEmbeddingPart* FW_MProxy::GetPart(Environment*) const
  234. {
  235.     return fPart;
  236. }
  237.  
  238. //----------------------------------------------------------------------------------------
  239. //    FW_MProxy::GetPresentation
  240. //----------------------------------------------------------------------------------------
  241. inline FW_CPresentation* FW_MProxy::GetPresentation(Environment*) const
  242. {
  243.     return fPresentation;
  244. }
  245.  
  246. //----------------------------------------------------------------------------------------
  247. //    FW_MProxy::GetSelectState
  248. //----------------------------------------------------------------------------------------
  249. inline FW_Boolean FW_MProxy::GetSelectState(Environment*) const
  250. {
  251.     return fSelected;
  252. }
  253.  
  254. //----------------------------------------------------------------------------------------
  255. //    FW_MProxy::PrivEmbeddedFacetAdded
  256. //----------------------------------------------------------------------------------------
  257. inline void FW_MProxy::PrivEmbeddedFacetAdded(Environment*)
  258. {
  259.     fEmbeddedFacetCount++;
  260. }
  261.  
  262. //----------------------------------------------------------------------------------------
  263. //    FW_MProxy::PrivEmbeddedFacetRemoved
  264. //----------------------------------------------------------------------------------------
  265. inline void FW_MProxy::PrivEmbeddedFacetRemoved(Environment*)
  266. {
  267.     FW_ASSERT(fEmbeddedFacetCount != 0);
  268.     fEmbeddedFacetCount--;
  269. }
  270.  
  271. //----------------------------------------------------------------------------------------
  272. //    FW_MProxy::GetFrameGroup
  273. //----------------------------------------------------------------------------------------
  274. inline ODID FW_MProxy::GetFrameGroup(Environment*) const
  275. {
  276.     return fFrameGroup;
  277. }
  278.  
  279. //----------------------------------------------------------------------------------------
  280. //    FW_MProxy::GetSequenceNumber
  281. //----------------------------------------------------------------------------------------
  282. inline ODID FW_MProxy::GetSequenceNumber(Environment*) const
  283. {
  284.     return fSequenceNumber;
  285. }
  286.  
  287. //----------------------------------------------------------------------------------------
  288. //    FW_MProxy::IsShown
  289. //----------------------------------------------------------------------------------------
  290. inline FW_Boolean FW_MProxy::IsShown(Environment*) const
  291. {
  292.     return fShown;
  293. }
  294.  
  295. #endif
  296.  
  297.